﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace RiskMan.Views.Dialogs
{

    /// <summary>
    /// Логика взаимодействия для DialogYesNo.xaml
    /// </summary>
    public partial class DialogUpdateYesNo : Window
    {
        public MessageBoxResult Result;

        #region Constructors
        
        
        public DialogUpdateYesNo ( )
        {
            InitializeComponent( );

            CheckBox1.IsChecked = RiskMan.Properties.Settings.Default.CheckUpdate;

            if ( CheckBox1.IsChecked == false )
                Result = MessageBoxResult.No;
            else
                this.ShowDialog( );
        }

       
        public DialogUpdateYesNo ( object message, String title )
        {
            InitializeComponent( );
            this.Title = title;
            this.messageBox.Text = message.ToString( );

            CheckBox1.IsChecked = RiskMan.Properties.Settings.Default.CheckUpdate;

            if ( CheckBox1.IsChecked == false )
                Result = MessageBoxResult.No;
            else
                this.ShowDialog( );

           // this.ShowDialog( );
        }

        #endregion

        private void buttonNo_Click ( object sender, RoutedEventArgs e )
        {
            Result = MessageBoxResult.No;
            Close( );
        }

        private void buttonYes_Click ( object sender, RoutedEventArgs e )
        {
            Result = MessageBoxResult.Yes;
            Close( );
        }

        private void CheckBox1_Checked ( object sender, RoutedEventArgs e )
        {
            RiskMan.Properties.Settings.Default.CheckUpdate = CheckBox1.IsChecked.Value;
            RiskMan.Properties.Settings.Default.Save( );
        }

        
    }
}
